package com.fesine.ch02.doubleSynBlockOneTwo;

/**
 * @Author: Fesine
 * @CreateDate:2016/6/30
 * @UpdateUser:修改人名称
 * @UpdateDate:2016/6/30
 * @UpdateRemark:修改具体的内容
 */
public class ObjectService {
    public void serviceMethodA() {
        try {
            synchronized (this) {
                System.out.println("A begin time="+System.currentTimeMillis());
                Thread.sleep(2000);
                System.out.println("A end time=" + System.currentTimeMillis());
            }

        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public void serviceMethodB(){
        synchronized (this) {
            System.out.println("B begin time=" + System.currentTimeMillis());
            System.out.println("B end time=" + System.currentTimeMillis());
        }
    }
}
